package uutalk.netcloud.talk.base.util.thirdpart;

import android.app.Activity;
import android.content.Context;

import uutalk.netcloud.talk.base.util.TalkInterface;

/**
 * Created by hujie on 2017/8/4.
 */

public class TalkManager {

    private static TalkManager INSTANCE;
    private TalkInterface talkInterface;

    public static TalkManager getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new TalkManager();
        }
        return INSTANCE;
    }

    private TalkManager() {
        talkInterface = new TXGClodeVoice();
    }

    public void init(Context context, Activity activity, String uid) {
        talkInterface.init(context, activity, uid);
    }

    public void joinChannel(String channel, String uid) {
        talkInterface.joinChannel(channel, uid);
    }

    public void leaveChannel() {
        talkInterface.leaveChannel();
    }

    public void destory() {
        talkInterface.destory();
        if (INSTANCE != null) {
            INSTANCE = null;
        }
    }

    public void openMic(boolean open) {
        talkInterface.openMic(open);
    }

    public void openSpeaker(boolean open) {
        talkInterface.openSpeaker(open);
    }

    public void pauseChannel() {
        talkInterface.pauseChannel();
    }

    public void resumeChannel() {
        talkInterface.resumeChannel();
    }


    public String getCurrentChannel() {
        return talkInterface.getCurrentChannel();
    }


    public TalkInterface getTalkInterface() {
        return talkInterface;
    }

    public int getMicLevel(){
        return talkInterface.getMicLevel();
    };
}
